package com.example.famhealing;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;

public class MenuBarActivity extends Activity {
	LinearLayout menubar;
	int flg = 0;
	ImageButton button1;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_menu_bar);
		
		menubar = (LinearLayout)findViewById(R.id.menubar);
		menubar.setVisibility(View.GONE);
		
		button1 = (ImageButton)findViewById(R.id.ex);
	}

	public void onClick (View v) {
		Animation ani = null;
		Intent intent;
		switch(v.getId()) {
		case R.id.menubtn:
			if (flg == 0) {
				menubar.setVisibility(v.VISIBLE);
				ani = AnimationUtils.loadAnimation(this, R.anim.down);
				menubar.startAnimation(ani);
				flg = 1;
				button1.setClickable(false);
//				button1.setFocusable(false);
			}
			break;
		case R.id.framelayout:
			if (flg == 1) {
				ani = AnimationUtils.loadAnimation(this, R.anim.up);
				menubar.startAnimation(ani);
				menubar.setVisibility(v.GONE);
				flg = 0;
				button1.setClickable(true);
			}
			break;
		case R.id.schedulebtn:
			intent = new Intent(this, com.example.famhealing.schedule.CalendarActivity.class);
			intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(intent);
			finish();
			break;
		case R.id.ex:
			intent = new Intent(this, com.example.famhealing.schedule.CalendarActivity.class);
//			intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(intent);
			break;
		}
	}
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.menu_bar, menu);
		return true;
	}

}
